# Script to restart bulk_ros PBS script, without repeating what we've already done.

# File name is $1

# Get last PDB code we started to processed
last_pdb=`tail -n2 $1.output | head -n1 | grep -o "rosetta_output/.*_ala" | cut -d"/" -f 2 | sed 's/_ala//'`;
echo $last_pdb

# Find code in PBS script (get line number)
line_num=`grep -n $last_pdb $1 | head -n1 | cut -d':' -f1`;

# Subtract one, so we don't comment this current one out.
line_num=$(($line_num-1))

echo $line_num

# Comment PBS script up to that line
sed -i "10,$line_num s/^/#/" $1;

#qsub $1;